home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 401-425 / disk_415 / uedit / config!r < prev    next >
Text File  |  1992-05-06  |  10KB  |  286 lines

  1. ======= AREXX CMDS ======
  2. Major modifications to this file by Kerry Zimmerman [71470,1340] 4/14/89
  3. o  Changed output buffer to 62, input buffer to 61 to avoid conflict with
  4.    Eric Kennedy's VI extensions.
  5. o  altctl-9 now displays current autotraffic status
  6. o  altctl-0 now asks for a command name and a list of macronums.
  7.    It adds these to the end of file U:REXXCOMM.  This file is a database
  8.    of macros understood by the new rexx autotraffic handler.
  9.  
  10. Edit Rexx output buffer 62
  11. <altCtl-1:
  12.     equateLoc(buf62,sPage,sFile)
  13.     editBuf(buf62) >
  14.  
  15. Edit Rexx input buffer 61
  16. <altCtl-2:
  17.     equateLoc(buf61,sPage,sFile)
  18.     editBuf(buf61) >
  19.  
  20. Send output buffer 62 to Rexx
  21. <altCtl-3:
  22.     equateNum(n98,0)                     .. 0 flag means send msg, not reply
  23.     rexxOut(buf62,all,0,n98,n99)   .. 0 ActionResult means default to RXCOMM
  24.     runKey(virtual-s) >
  25.  
  26. Fetch Rexx input into buffer 61
  27. <altCtl-4:
  28.     if (rexxIn(buf61,sFile,n97,n98,n99)) {
  29.         ..if (eqNum(n98,0)) {       .. if Msg
  30.             equateLoc(buf61,sPage,sFile)
  31.             editBuf(buf61)
  32.         ..}
  33.      }
  34.      runKey(virtual-r) >
  35.  
  36. Send hilite region to Rexx.
  37. <altCtl-5:
  38.     equateNum(n98,0)                               .. 0 means msg, not reply
  39.     rexxOut(curFile,hilite,0,n98,n99)  .. 0 means default to Action = RXCOMM
  40.     runKey(virtual-s) >
  41.  
  42. Fetch Rexx input at cursor
  43. <altCtl-6:
  44.     rexxIn(curFile,atCursor,n97,n98,n99)
  45.     runKey(virtual-r) >
  46.  
  47. Send an OK reply to Rexx  (NOTE: Amiga-ESC abort sends Failed reply.)
  48. <altCtl-7:
  49.     equateNum(n98,1)                               .. 1 means reply, not msg
  50.     rexxOut(" ",all,0,n98,n99)                           .. 0 is OKAY result
  51.     runKey(virtual-s) >
  52.  
  53. Send an OK reply to Rexx along with text in hilite region
  54. <altCtl-8:
  55.     equateNum(n98,1)
  56.     rexxOut(curFile,hilite,0,n98,n99) ..text NOT sent, if not RXFB_RESULT msg
  57.     runKey(virtual-s) >
  58.  
  59. Toggle flag to handle Rexx traffic automatically during idle periods.
  60. <altCtl-9:
  61.                                            .. set idletime back to old value
  62.     if (getFlag(curFile,userGlobalB)) {
  63.         equateNum(idleTime,n36)
  64.         putMsg("AutoTraffic is OFF")
  65.     }
  66.     else {                .. idleTime not 0, toggle to auto-traffic handling
  67.         equateNum(n36,idleTime)                     .. store idleTime in n36
  68.         equateNum(idleTime,0)                           .. set idleTime to 0
  69.         putMsg("AutoTraffic is ON")
  70.     }
  71.     flipFlag(curFile,userGlobalB)                             .. toggle flag
  72.     swapKey(idle,virtual-t)         .. swap in/out the auto-traffic idle cmd
  73. >
  74.  
  75.  
  76. Make an x.rexx program with commands to send to Uedit.
  77. <altCtl-0:
  78.     freebuf(buf35)
  79.     if (!loadfile("REXXCOMM")) loadfile("S:REXXCOMM")
  80.     movecursor(curFile,eFile)
  81.     putmsg("Enter new command's name")
  82.     freebuf(buf50)
  83.     inputString(buf50)
  84.     insertRgn(curFile,atCursor,buf50,all)
  85.     insertRgn(curFile,atCursor,"        |
  86. ",all)
  87.     movecursor(curFile,sChar)
  88.     movecursor(curFile,sChar)
  89.     updateDisplay
  90.     while (nothing) {
  91.         putMsg("Give desired inputs.  Amiga-ESC when done.  F2 to save.")
  92.         getKeyVal(macroNum,inputChar)
  93.         toWord(curFile,macroNum)
  94.         insertChar(curFile,"+")
  95.         toWord(curFile,inputChar)
  96.         insertChar(curFile," ")
  97.         updateDisplay
  98.         fileSize(curFile,n54) .. force pack, avoid mem-abort
  99.     }
  100. >
  101.  
  102. <virtual-t:
  103.     if (rexxIn(buf61,eFile,n97,n98,n99)) {           .. if fetched something
  104.          ..runKey(virtual-r)         .. show flags - slower if use this line
  105.         if (eqNum(n98,0)) {                   .. if recvd a Msg, not a Reply
  106.  
  107.             equateNum(n96,0)
  108.             push(n99,searchCaps)     .. (RS mod)
  109.             equateNum(searchCaps,0) .. turn off case sensitivity (RS mod)
  110.             runkey(virtual-y)
  111.             pop(n99,searchCaps)      .. restore orig case sensitivity (RS mod)
  112.             freeBuf(buf61)
  113.             if(not eqNum(n96,0)) return .. comand already sent a reply
  114.             if(eqLoc(curFile,sInvert,eInvert)) goto label(50)
  115.             rexxOut(curFile,Invert,0,1,n99) .. search uses this as an example
  116.             return
  117.  
  118. label(50)   rexxOut(" ",all,0,1,n99)
  119.         }
  120.     }
  121. >
  122.  
  123. handle named macro messages
  124. <virtual-y:
  125.                 .. if buf35 doesn't contain the named commands yet
  126.                 .. read it in
  127.                     moveCursor(buf35,sfile)
  128.                     freeBuf(buf50)
  129.                     insertRgn(buf50,atCursor,"REXXCOMM",all)
  130.                       setSearch(buf50)
  131.                       if(not search(buf35,sHilite,eHilite,1)) {
  132.                         freeBuf(buf35)
  133.                         if(!insertFile(buf35,sfile,"REXXCOMM")
  134.                             & !insertFile(buf35,sfile,"S:REXXCOMM")) {
  135.                             putmsg("file REXXCOMM not found")
  136.                             returnFalse
  137.                         }
  138.                     }
  139.  
  140.                 .. extract 1st word of buf61 which is the command
  141.                     moveCursor(buf61,sfile)
  142.                     equateLoc(buf61,sHilite,atCursor)
  143.                     moveCursor(buf61,eWord)
  144.                     equateLoc(buf61,eHilite,atCursor)
  145.                     freebuf(buf50)
  146.                     insertRgn(buf50,sFile,buf61,Hilite) ..save command
  147.  
  148.                     clearRgn(buf61,Hilite) ..erase command leaving any args
  149.                     while(is(buf61,whiteSpace))
  150.                         clearChar(buf61)
  151.                     setSearch(buf50)
  152.  
  153.                 .. search for this command in list of commands in buf35
  154.                     moveCursor(buf35,sfile)
  155.                     moveCursor(buf35,eLine) .. start search after 1st line
  156.                     if(not search(buf35,sHilite,eHilite,1)) {
  157.                         freeBuf(buf54)
  158.                         insertRgn(buf54,efile,"REXX command NOT found: ",all)
  159.                         insertRgn(buf54,efile,buf50,all)
  160.                         returnFalse
  161.                     }
  162.  
  163.                 .. move to the first macronum
  164.                     moveCursor(buf35,eHilite)
  165.  
  166.                 .. process each macronum+inputchar pair until "|" found
  167.  
  168.            label(10)
  169.                     while(is(buf35,whitespace))
  170.                         moveCursor(buf35,echar)
  171.                 .. return if end of commands
  172.                     if(is(buf35,"|") | is(buf35,eFile)) returnTrue
  173.  
  174.                 .. convert xx+yy to macronum-xx, inputchar-yy
  175.                     equateNum(macroNum,0)
  176.                     equateNum(inputChar,0)
  177.                     if(is(buf35,digit)) {
  178.                         toNumber(macroNum,buf35)
  179.                         while(is(buf35,digit))
  180.                             moveCursor(buf35,echar)
  181.                         if(is(buf35,"+")){
  182.                             moveCursor(buf35,echar)
  183.                             if(is(buf35,digit)){
  184.                                 toNumber(inputChar,buf35)
  185.                                 while(is(buf35,digit))
  186.                                     moveCursor(buf35,echar)
  187.                             }
  188.                         }
  189.                     }
  190.                  .. run valid macroNum, or type valid inputChar
  191.                     if(inUse(macroNum)) runKey(macroNum)
  192.                     else if(gtNum(inputChar,0)) TypeChar(inputChar)
  193.                     else return
  194.                     goto label(10) >
  195.  
  196.  
  197. Show numbers for a received Arexx msg or reply
  198. <virtual-r:
  199.         if (not eqNum(n99,0)) runKey(virtual-m)           .. rexxIn() failed
  200.         else {                                         .. rexxIn() succeeded
  201.             if (eqNum(n98,0)) {              .. MSG: show action & modifiers
  202.                 and(n96,n97,0X0F000000)                .. get ACTION code
  203.                 and(n95,n97,0X000F0000)                .. get MODIFIER
  204.                 if(gtNum(n95,0)) div(n95,n95,0x10000)
  205.                 freeBuf(buf54)
  206.                 insertRgn(buf54,atCursor,"Msg fetched:  Action = ",all)
  207.                 toWord(buf54,n96)
  208.                 insertRgn(buf54,atCursor,"  Modifier = ",all)
  209.                 toWord(buf54,n95)
  210.                 ..insertRgn(buf54,atCursor,"  -- press return",all)
  211.                 putMsg(buf54)
  212.             } else {                                              .. REPLY:
  213.                 if (eqNum(n97,0)) putMsg("Reply fetched.  Result OKAY")
  214.                 else {
  215.                     freeBuf(buf54)
  216.                     insertRgn(buf54,atCursor,
  217.                         "Reply received:  Result = ERROR ",all)
  218.                     toWord(buf54,n97)
  219.                     ..insertRgn(buf54,atCursor,"  -- press return",all)
  220.                     putMsg(buf54)
  221.                 }
  222.             }
  223.         }
  224. ..getkey(n50)
  225. >
  226.  
  227. Show numbers for a sent ARexx msg or reply
  228. <virtual-s:
  229.         if (not eqNum(n99,0)) runKey(virtual-m)          .. rexxOut() failed
  230.         else {
  231.             if (eqNum(n98,0)) putMsg("Msg sent")
  232.             else              putMsg("Reply sent")
  233.         }
  234. >
  235.  
  236. Show returncode error msgs
  237. <virtual-m:
  238.     switch(n99) {
  239.     case(-1) { putMsg("ARexx not up") }
  240.     case(-2) { putMsg("No memory or no text") }
  241.     case(-3) { putMsg("Msg/reply > 65535 bytes") }
  242.     case(-4) { putMsg("Nothing to fetch or reply to") }
  243.     case(-5) { putMsg("Fetch reply before sending this msg/reply") }
  244.     }
  245.     returnFalse                   .. so virtual-r/-s above will return False
  246. >
  247.  
  248. ====================================================================
  249. Some useful functions for the arexx macros
  250.  
  251. The 'ask' macro.  Usage:  ask 'Do you want to continue?'
  252. ask a question and return true or false
  253. <virtual-i:
  254.         equateNum(n96,1)
  255.         if(askYesNo(buf61))
  256.             rexxOut("YES",all,0,1,n99)
  257.         else
  258.             rexxOut("NO",all,0,1,n99)
  259. >
  260.  
  261. the 'text' macro.  Usage:  text 'this will be inserted'
  262. insert text at cursor
  263. <virtual-h: insertRgn(curFile,atCursor,buf61,all)
  264.             updatedisplay>
  265.  
  266. the 'loadfile' macro.  Usage: loadfile 'sys:myfile'
  267. edit given file
  268. <virtual-j:    loadfile(buf61)>
  269.  
  270. the 'gotoline' macro  Usage: gotoline 100
  271. goto line
  272. <virtual-n:    toNumber(n50,buf61)
  273.             lineToLoc(curFile,atCursor,n50) >
  274.  
  275. the 'searchfor' macro  Usage: searchfor pattern
  276. search for a given string
  277. <virtual-o:    push(buf99,buf61)
  278.             pop(buf99,buf49)
  279.             setsearch(buf49)
  280.             runkey(normal-f9) >
  281.  
  282. The 'message' macro  Usage: message 'my message'
  283. issue a message
  284. <virtual-p:    putmsg(buf61) >
  285.  
  286.